﻿using System;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;

namespace TuyennvLibrary.ServerApi.Models
{
    public class GcmResponse
    {
        public int Success { get; set; }
        public int Failure { get; set; }
        public GcmResponse()
        {

        }
        public GcmResponse(Object response)
        {
            JObject item = JObject.FromObject(response);
            this.Success += (int)item["success"];
            this.Failure += (int)item["failure"];
        }
        public GcmResponse(List<object> listResponse)
        {
            JArray jarray = JArray.FromObject(listResponse);
            foreach (JObject item in jarray)
            {
                this.Success += (int)item["success"];
                this.Failure += (int)item["failure"];
            }

        }
        public override string ToString()
        {
            return string.Format("Success: {0}\nFailure:{1}", Success, Failure);
        }
    }
}
